<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>倒计时</title>
    <style media="screen">
      #container{
        width: 200px;
        height: 80px;
        line-height: 80px;
        margin: 0 auto;
        color: black;
        text-align: center;
        background-color: #9da;
      }
    </style>
  </head>
  <body>
    <div id="container">

    </div>
    <script type="text/javascript">
    window.onload = function(){
      showtime();
          }
      function showtime(){
        var endTime = new Date("2016/10/25,14:20:30");
        var curtime = new Date();
        var lefttime = parseInt((endTime.getTime() - curtime.getTime())/1000);

        var d = parseInt(lefttime/(24*60*60));
        var h =parseInt(lefttime/(60*60)%24);
        var min = parseInt(lefttime/60%60);
        var s = parseInt(lefttime%60);
        document.getElementById('container').innerHTML =d+"天"+h+"小时"+min+"分钟"+s+"秒";
        setTimeout(showtime,1000);
      }


    </script>
  </body>
</html>
